package com.niji.littly_donkey_android.activity;

import android.content.Intent;
import android.graphics.Color;
import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.view.WindowManager;
import android.widget.Button;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;
import com.niji.littly_donkey_android.R;
import com.niji.littly_donkey_android.util.StatusBarUtil;
import com.niji.littly_donkey_android.view.CommissionVideoFlowLayoutView;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewGroup.MarginLayoutParams;


public class CommissionVideoActivity extends AppCompatActivity {

    private Button commission_video_return;

    private Button commission_video_withdrawal;

    private TextView video_rank;

    private TextView video_details;

    private TextView commission_video_bank;

    private TextView commission_money;



    @Override
    public void onCreate(final Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.commission_video_activity);
//        init();
        CommissionVideoReturn();
        CommissionVideoWithdrawal();
        VideoDetails();
        VideoRank();
        videoRank();
        changeStatusBarTextImgColor(true);

    }

    /**
     * 界面设置状态栏字体颜色
     */
    public void changeStatusBarTextImgColor(boolean isBlack) {
        if (isBlack) {
            //设置状态栏黑色字体
            getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
        } else {
            //恢复状态栏白色字体
            getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE);
        }
    }

    @Override
    protected void onStart() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            Window window = getWindow();
            //不加这个clearFlags好像就没效果
            window.clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
            window.getDecorView().setSystemUiVisibility(
                    View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
                            | View.SYSTEM_UI_FLAG_LAYOUT_STABLE);
            //设置导航栏透明(就是虚拟键那一栏)
             
            //设置状态栏(或者叫通知栏)透明
             
            window.setStatusBarColor(Color.TRANSPARENT);
        }
        super.onStart();
    }

//    private void init() {
//        commission_money = commission_money.findViewById(R.id.commission_money);
//        String url = UrlUtil.URL + "/ /";
//        JSONObject jsonObject = new JSONObject();
//        RequestQueue requestQueue = Volley.newRequestQueue(CommissionVideoActivity.this);
//        JsonObjectRequest jsonObjectRequest = new JsonObjectRequest(Request.Method.POST, url, jsonObject, new Response.Listener<JSONObject>() {
//            //回调
//            @Override
//            public void onResponse(JSONObject jsonObject) {
//                String commissionMoney = "";
//                try {
//                    commissionMoney = jsonObject.getString("");
//                } catch (JSONException e) {
//                    e.printStackTrace();
//                }
//                commission_money.setText("￥"+commissionMoney);
//            }
//        }, new Response.ErrorListener() {
//            @Override
//            public void onErrorResponse(VolleyError volleyError) {
//                Toast.makeText(CommissionVideoActivity.this, "网络出错", Toast.LENGTH_SHORT).show();
//            }
//        });
//
//    }

    private void CommissionVideoReturn() {
        commission_video_return = findViewById(R.id.commission_video_return);
        commission_video_return = findViewById(R.id.commission_video_return);
        commission_video_return.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                overridePendingTransition(R.anim.xpage_slide_in_left,R.anim.xpage_slide_out_right);
                finish();
            }
        });
    }

    private void CommissionVideoWithdrawal() {
        commission_video_withdrawal = findViewById(R.id.commission_video_withdrawal);
        commission_video_withdrawal = findViewById(R.id.commission_video_withdrawal);
        commission_video_withdrawal.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(CommissionVideoActivity.this, BillBillActivity.class));
                   
            }
        });
    }

    private void VideoRank() {
        video_rank = findViewById(R.id.video_rank);
        video_rank = findViewById(R.id.video_rank);
        video_rank.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(CommissionVideoActivity.this,CommissionRankActivity.class));
                   
            }
        });
    }

    private void VideoDetails() {
        video_details = findViewById(R.id.video_details);
        video_details = findViewById(R.id.video_details);
        video_details.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(CommissionVideoActivity.this,BillDetailsActivity.class));
                   
            }
        });
    }

    private void videoRank() {
        commission_video_bank = findViewById(R.id.commission_video_bank);
        commission_video_bank = findViewById(R.id.commission_video_bank);
        commission_video_bank.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                startActivity(new Intent(CommissionVideoActivity.this,BillBankCardActivity.class));
                   
            }
        });
    }


}
